package work3_9;

import java.util.HashSet;
import java.util.Set;

public class Demo7 {
    /**
     * 国际摩尔斯密码定义一种标准编码方式，将每个字母对应于一个由一系列点和短线组成的字符串， 比如:
     *'a' 对应 ".-" ，
     * 'b' 对应 "-..." ，
     * 'c' 对应 "-.-." ，以此类推。
     */
    public static void main(String[] words) {
        String[] str={"gin", "zen", "gig", "msg"};
        System.out.println(count(str));

    }
    public static int count(String[] words){
        String[] m={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
        Set set=new HashSet();
        for (int i = 0; i < words.length; i++) {
            StringBuilder result=new StringBuilder();
            for (int j = 0; j < words[i].length(); j++) {
                char c=words[i].charAt(j);
                result.append(m[c-97]);
            }
            set.add(result.toString());
        }
        return set.size();
    }

}